# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ProximityBeacon.V1beta1.Model.Observation do
  @moduledoc """
  Represents one beacon observed once.

  ## Attributes

  *   `advertisedId` (*type:* `GoogleApi.ProximityBeacon.V1beta1.Model.AdvertisedId.t`, *default:* `nil`) - The ID advertised by the beacon the client has encountered.

      If the submitted `advertised_id` type is Eddystone-EID, then the client
      must be authorized to resolve the given beacon. Otherwise no data will be
      returned for that beacon.
      Required.
  *   `telemetry` (*type:* `String.t`, *default:* `nil`) - The array of telemetry bytes received from the beacon. The server is
      responsible for parsing it. This field may frequently be empty, as
      with a beacon that transmits telemetry only occasionally.
  *   `timestampMs` (*type:* `DateTime.t`, *default:* `nil`) - Time when the beacon was observed.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :advertisedId => GoogleApi.ProximityBeacon.V1beta1.Model.AdvertisedId.t(),
          :telemetry => String.t(),
          :timestampMs => DateTime.t()
        }

  field(:advertisedId, as: GoogleApi.ProximityBeacon.V1beta1.Model.AdvertisedId)
  field(:telemetry)
  field(:timestampMs, as: DateTime)
end

defimpl Poison.Decoder, for: GoogleApi.ProximityBeacon.V1beta1.Model.Observation do
  def decode(value, options) do
    GoogleApi.ProximityBeacon.V1beta1.Model.Observation.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.ProximityBeacon.V1beta1.Model.Observation do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
